package org.example.shop.shiro;

import lombok.Data;
import org.apache.shiro.authc.AuthenticationToken;
import org.example.shop.pojo.UserInfo;

@Data
public class UserToken implements AuthenticationToken {
    private String token;
    private UserInfo userInfo;

    public void createToken() {
        this.token = "token:" + userInfo.getId() + "-" + userInfo.getUsername();
    }

    @Override
    public Object getPrincipal() {
        return token;
    }

    @Override
    public Object getCredentials() {
        return token;
    }
}
